/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package game.jetclan.main;

import com.jme3.asset.AssetManager;
import com.jme3.bullet.control.RigidBodyControl;
import com.jme3.material.Material;
import com.jme3.math.FastMath;
import com.jme3.math.Vector3f;
import com.jme3.scene.Node;
import com.jme3.scene.Spatial;

/**
 *
 * @author cla_marwas
 */
public class GameUnit implements PlayableObject {

    private Node mMainNode = null;

    public GameUnit(AssetManager aAssetManager) {
        mMainNode = (Node) aAssetManager.loadModel("Models/AirCraft/AirCraft.j3o");
        mMainNode.setName("GameUnit");
        Material materialDefault = new Material(aAssetManager, "Common/MatDefs/Misc/ShowNormals.j3md");
        mMainNode.setMaterial(materialDefault);
        mMainNode.scale(0.5f);
        //Sphere sphereSmall = new Sphere(32, 32, 0.2f, true, false);
        //cannon = 
// /** Load a Node from a .j3o file */
// String userHome = System.getProperty("user.home");
// BinaryImporter importer = BinaryImporter.getInstance();
// importer.setAssetManager(assetManager);
// File file = new File(userHome+"/somefile.j3o");
// try {
//   Node loadedNode = (Node)importer.load(file);
//   loadedNode.setName("loaded node");
//   rootNode.attachChild(loadedNode);
// } catch (IOException ex) {
//   Logger.getLogger(Main.class.getName()).log(Level.SEVERE, "No saved node loaded.", ex);
// } 


//Implement character control to set up physics        
        //mCharacterControl = new RigidBodyControl(aMass);
//mCharacterControl.setGravity(new Vector3f(0,30,0));
        //mMainNode.addControl(mCharacterControl);
//        mainNode.attachChild(cannon);
        mMainNode.rotate(0, -FastMath.HALF_PI, 0);

    }

    public Spatial getMainNode() {
        return mMainNode;
    }

    public void setLocalTranslation(Vector3f aVector3f) {
        mMainNode.setLocalTranslation(aVector3f);
    }
}
